#ifndef __EMP_BASIC_H__
#define __EMP_BASIC_H__

//#include <stdio.h>
//#include <stdlib.h>
//#include <slave.h>
//#include "dma.h"
//#ifdef DEBUG
//#include <assert.h>
//#endif
//#include "MemPool.h"
#include "args.h"



#ifdef EMP_QUEUE
#ifdef TARG_SW5
  #ifdef EMP_MASTER
    #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
#define INITIAL_MASTER_QUEUE_SIZE 1024
    #else
#define INITIAL_MASTER_QUEUE_SIZE 32768
    #endif
  #endif

  #if !defined(LDM_QUEUE) && !defined(HIER_QUEUE_LIFO)
struct task * big_array[INITIAL_QUEUE_SIZE];   // basic queue in mmem
    #ifdef EMP_MASTER
struct task * master_big_array[INITIAL_MASTER_QUEUE_SIZE]; 
    #endif
  #endif

typedef struct EQ_queue {
  #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
    struct task * array[INITIAL_QUEUE_SIZE];
  #else  // MMEM_QUEUE
    struct task ** array; // -->big_array
    #ifdef EMP_CONCURRENT_Q
    volatile int my_q_lock;
    #endif
  #endif
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_queue;

  #ifdef EMP_MASTER
typedef struct EQ_master_queue {
    #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
    struct task * array[INITIAL_MASTER_QUEUE_SIZE];
    #else   // MMEM_QUEUE
    struct task ** array;  // -->master_big_array
      #ifdef EMP_CONCURRENT_Q
    volatile int my_q_lock;
      #endif
    #endif
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_master_queue;
  #endif

//  #if  defined(EMP_MASTER) && defined(EMP_CONCURRENT_Q)
//    extern EQ_master_queue master_queue;
//  #endif
//  #if defined(EMP_CONCURRENT_Q)
//    extern EQ_queue global_cent_queue;
//  #endif

#else

#ifdef EMP_MASTER
    #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
#define INITIAL_MASTER_QUEUE_SIZE 1024
    #else
#define INITIAL_MASTER_QUEUE_SIZE 32768
    #endif
  #endif

  #if !defined(LDM_QUEUE) && !defined(HIER_QUEUE_LIFO)
struct task * big_array[INITIAL_QUEUE_SIZE];   // basic queue in mmem
    #ifdef EMP_MASTER
struct task * master_big_array[INITIAL_MASTER_QUEUE_SIZE]; 
    #endif
  #endif

typedef struct EQ_queue {
  #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
    struct task * array[INITIAL_QUEUE_SIZE];
  #else  // MMEM_QUEUE
    struct task ** array; // -->big_array
    #ifdef EMP_CONCURRENT_Q
    volatile int my_q_lock;
    #endif
  #endif
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_queue;

  #ifdef EMP_MASTER
typedef struct EQ_master_queue {
    #if defined(LDM_QUEUE) || defined(HIER_QUEUE_LIFO)
    struct task * array[INITIAL_MASTER_QUEUE_SIZE];
    #else   // MMEM_QUEUE
    struct task ** array;  // -->master_big_array
      #ifdef EMP_CONCURRENT_Q
    volatile int my_q_lock;
      #endif
    #endif
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_master_queue;
#endif
/*
#ifdef EMP_MASTER
#define INITIAL_MASTER_QUEUE_SIZE 1024
struct task * master_big_array[INITIAL_MASTER_QUEUE_SIZE]; 
#endif

#define  INITIAL_LDM_QUEUE_SIZE 32768
typedef struct EQ_queue {
    struct task * array[INITIAL_LDM_QUEUE_SIZE]; // -->big_array
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_queue;
#ifdef EMP_MASTER
typedef struct EQ_master_queue {
    struct task * array[INITIAL_MASTER_QUEUE_SIZE];
    unsigned size;
    unsigned head;
    unsigned tail;
} EQ_master_queue;
  #endif
*/
#endif
#endif


#endif
